﻿$(function () {
    $("#btnSave").click(function () {

        if (!$("#myForm").valid()) {
            return;
        }
        $.post("/Menu/UpdateMenu", {
            Id: $("#Id").val(),
            Name: $("#Name").val(),
            LinkURL: $("#LinkURL").val(),
            Description: $("#Description").val(),
            IsMenu: $("input:radio[name='IsMenu']:checked").val(),
            IsDisplay: $("input:radio[name='IsDisplay']:checked").val()
        }, function (data) {
            if (data == "True") {
                alert(SaveSuccess);
                window.location.href = "/Menu/Index";
            }
            else {
                alert(SaveFail);
            }
        });
    });

    $("#btnCancel").click(function () {
        window.location.href = "/Menu/Index";
    });
})

